Repository navigation
fix(collections): open library-tab collection items without a library scope - #478
Conversation
… scope Items in a collection opened from a library's Collections tab were read with that library's id. The server answers 404 for an item scoped to a library that does not hold it, so any item filed in another library showed as unavailable. User collections often mix libraries, and admin collections can be shown in libraries other than their primary one. Phone and TV now open these items without a library scope, like the personal Collections screens, the web client, and the Apple clients. The route's library id still loads the collection itself.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Both apps now open collection items by content ID without library scope, matching the client’s unscoped request path. No concrete regression is established in the reviewed changes. Security Architecture Review
Pre-merge checks |
|
|
Silo's pull request guidance changed today (#490). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: Before-and-after phone and TV screenshots of opening a cross-library item from a library's Collections tab: the unavailable screen before, the detail page after. The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in. Generated by Claude Code |
Quick104
left a comment
There was a problem hiding this comment.
Review of 421e106 against current main. The item-click change is correct on its own. Once it merges with main, two things need attention, and one needs a maintainer decision.
1. Collection shuffle still opens with the tab's library (phone and TV). Severity: medium.
Main gained collection shuffle (#476) in the same two destinations this PR changes. On phone, onShuffleStarted calls shufflePlayerRoute(shuffle, libraryId); on TV it calls navigateToTvShufflePlayback(shuffle, libraryId, ...). A collection shuffle draws from the whole collection, but the player sends every pick, later picks included, to GET /api/v2/watch/{id}?library_id=N, and the server returns 404 for an item outside library N.
- Trigger: a collection in the Movies library that also holds a series. Start Shuffle; any episode it picks fails to play.
- Evidence: on a sandbox built from silo-server main,
GET /api/v2/watch/<episode id>returns 200, and the same request withlibrary_idset to the Movies library returns 404. - Repair: start collection shuffles with no library, the same as item clicks. Apple already does this (
router.presentShuffle(shuffle)).
I'm fixing this in a commit on this branch, along with the merge from main, so there's no need to change it yourself.
2. The branch conflicts with main.
The conflict is the shuffle callback above, in the phone CollectionDetail destination. I'm resolving it with a merge commit, not a force-push.
3. Needs your call: on main, the phone no longer lists other libraries' items in a library-tab collection.
Since #447, the phone loads a library-tab collection with library_id set (the getLibraryCollectionItems(..., libraryId = libraryId, ...) call in CollectionDetailViewModel), and the server filters the list to that library. TV sends library_id only in a Movies or Series view (libraryId.takeIf { mediaScope != null }). On the sandbox, for a Movies-library collection holding two movies and two series, the request the phone makes returns the two movies, and the request TV makes returns all four.
So on main, the phone's item-click 404 can't be reached any more: those items are hidden instead. The phone half of this PR still keeps phone item clicks consistent with TV, Apple, and the web, and it matters again if the phone list goes back to showing every item. Options:
- (a) Keep this PR as is and track the phone list separately.
- (b) Also make the phone list unscoped outside a Movies or Series view in this PR, matching TV.
I'm not changing the list here, since that's #447's behavior and a separate concern.
Review by Claude Code (claude-opus-5-5), with a second opinion from Codex (gpt-6.1-sol).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cope A collection shuffle draws from the whole collection, but both apps started it with the tab's library, so the player asked for each pick with library_id set and the server returned 404 for any pick filed in another library. Start collection shuffles unscoped, like item clicks and the Apple apps, and drop the phone view model's unused browseLibraryId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
| onShuffleStarted = { shuffle -> | ||
| navController.navigate( | ||
| org.siloserver.silo.android.ui.screens.shuffle.shufflePlayerRoute( | ||
| shuffle, | ||
| backStackEntry.arguments?.getString("libraryId")?.toIntOrNull(), | ||
| ), | ||
| org.siloserver.silo.android.ui.screens.shuffle.shufflePlayerRoute(shuffle), | ||
| ) |
There was a problem hiding this comment.
Watch Party solo-playback guard bypass in the collection and series shuffle callbacks starts independent playback without leave confirmation while membership remains active, because PlayerScreen does not leave RoomSession on disposal. Wrap both new onShuffleStarted navigation callbacks in the existing externalSoloGuard.
Prompt for LLM
File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt:
Line 1181 to 1184:
Watch Party solo-playback guard bypass in the collection and series shuffle callbacks starts independent playback without leave confirmation while membership remains active, because PlayerScreen does not leave RoomSession on disposal. Wrap both new onShuffleStarted navigation callbacks in the existing externalSoloGuard.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
This gap predates this PR, so I'm leaving it out of scope here. The onShuffleStarted callbacks came from main in #476 through the merge; this PR's commit only drops the library argument. On main, none of the three phone shuffle entry points runs the solo guard: the collection and series callbacks in AppNavigation.kt, and the library shuffle in MainScreen.kt (rememberShuffleLauncher { shuffle -> navController.navigate(shufflePlayerRoute(...)) }). externalSoloGuard in AppNavigation.kt covers external routes only. If shuffle should confirm before leaving a Watch Party, all three need the guard at once, and that belongs in its own change against #476's shuffle. I haven't confirmed the leave-on-disposal claim.
Claude Code (claude-opus-5-5)
There was a problem hiding this comment.
Agreed—my suggestion incorrectly treated a pre-existing shuffle behavior as a regression introduced by this PR.
Based on the history you’ve described, #478 only removes the library scope from collection navigation and shuffle playback. The callbacks came from #476, and the same guard gap affects all three phone shuffle entry points. Wrapping just the two callbacks I cited would be an incomplete fix, and externalSoloGuard should not be treated as a general shuffle guard without checking its intended use.
I retract this suggestion as a required change for #478. Any Watch Party confirmation change should be reviewed separately across all three entry points.
I also retract the definite claim about PlayerScreen disposal: that behavior has not been verified here and should be traced before asserting that room membership remains active.
Review summaryFit: 9/10 · Readiness: 8/10 — conditional Addressed
Remaining
Validated features: no passed validation case covers collections or collection shuffle. Checks run: Evidence: https://evidence.siloserver.org/r/silo-android/pr-478/ User manual: no change needed. The collections page already says that selecting a title in a collection opens it. Apple and Android: Apple's counterpart (Silo-Server/silo-apple#619) is merged, and Apple already starts collection shuffles without a library. No further Apple change is needed. Why these scores: Fit is high because the PR fixes a broken core path (opening and shuffling collection items) at the navigation boundary, and matches how Apple, the web, and personal collections already open items, without adding any setting or API surface. Readiness is held at 8 by the open phone-list decision and the draft status, not by a known defect. Review by Claude Code (claude-opus-5-5), with a second opinion from Codex (gpt-6.1-sol). |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Problem
Related issue: N/A (Apple counterpart: Silo-Server/silo-apple#619)
Validation tasks: none
Opening a collection from a library's Collections tab and selecting an item can show "unavailable" for an item that exists. Both the phone and TV apps open the item with the library the tab belongs to, item detail then reads
GET /api/v2/catalog/items/{id}?library_id=N, and the server returns 404 for an item outside that library. User collections often mix libraries, and an admin collection can also be shown in libraries other than its primary one, so any item filed elsewhere fails.Reproduced against a real server (build-1116) with that request:
library_idset to the library holding most of them, 67 return 404 with another library the collection is shown in, and all 78 return 200 withoutlibrary_id.Approach
The phone
CollectionDetaildestination and the TVLibraryCollectionDetaildestination now open items without alibraryId. The route'slibraryIdstill loads the collection itself. Personal collections, the web client, and the Apple fix (Silo-Server/silo-apple#619) already open collection items this way.Main has since added collection shuffle (#476) to the same two destinations, and it started the player with the tab's library too, so a shuffle pick from another library failed with "Watch target not found" (
GET /api/v2/watch/{id}?library_id=Nreturns 404). A follow-up commit on this branch starts collection shuffles without a library on both apps, as Apple does, and removes the phone view model's unusedbrowseLibraryId. The branch is merged with main.Validation
:androidApp:testDebugUnitTest --tests '*CollectionRouteTest*'(6/6, including a new test that finds the scoped call in the old code and passes on the new code) and:androidTvApp:testDebugUnitTest --tests '*TvItemDetailNavigationTest*'(20/20) pass.:androidApp:assembleDebugand:androidTvApp:assembleDebugsucceed (JDK 21, Linux container).testDebugUnitTestsuite, the lint tasks, and the supply-chain scripts. I have not exercised the change on a device or emulator.Review follow-up on
6576f924d(merged with main05b3f916a), against a sandbox built from silo-server main, with a Movies-library collection holding two movies and two series:getWatchState404 before and 200 after.testDebugUnitTest(all modules), the five lint tasks, and bothassembleDebugtasks pass. The supply-chain scripts weren't run locally (the build host has noruby); CI runs them.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/pr-478/
Risks
Items opened from these collection screens no longer send
library_idfor detail, season, episode, player, or reader reads. That includes items that really are in the tab's library. This matches how items open from Home, Search, Favorites, Watchlist, and personal collections.Checklist
AI Disclosure
libraryId(item detail, seasons, episodes, player, audiobook player, book reader, the TV duplicate-entry check) and searched both collection screens for other library-scoped paths. It found none, and confirmed that personal collections behave as before. It flagged that the new test's first version scanned past the collection destination into item detail, which keeps its scope legitimately. That would have made the test fail on any code, so the scan now stops at the detail-screens marker. It also suggested a TV source-scan test and a shared slice helper for the existing test. Neither was added, to keep the change minimal.🤖 Generated with Claude Code
Note
Open library-tab collection items and shuffles without a library scope
Collection items can belong to libraries other than the collection screen's library, so item-detail and shuffle-player navigation no longer forwards that library ID. Applies to both Android (AppNavigation.kt) and TV (TvAppNavigation.kt); TV keeps the existing playback-navigation state argument.
CollectionDetailViewModelaccessor that exposed the library ID for shuffled playbackCollectionRouteTest.collectionItemsAndShufflesOpenWithoutALibraryScope, that fails if item navigation includes a library-scoped argument or shuffle navigation uses the scoped routeMacroscope summarized 6576f92.